﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using FRL.DebtChased.ChaseWorkspace.ChildWindows;
using FRL.DebtChased.ChildWindows;
using FRL.DebtChased.Silverlight.Library;
using FRL.DebtChased.Silverlight.Library.RichContentService;
using FRL.DebtChased.Silverlight.Library.Controls;

namespace FRL.DebtChased.ChaseWorkspace
{

	/// <summary>
	/// Declaration of SummaryPanelCtrl class
	/// The summary panel, including three concertinered controls
	/// </summary>
	public partial class SummaryPanelCtrl : UserControl
	{

		/////////////////////////////////////////////////////////////
		// Members

        private SwapPanelController controller;


		/////////////////////////////////////////////////////////////
		// Construction

		public SummaryPanelCtrl()
		{
            InitializeComponent();
            this.LayoutRoot.DataContext = this;

            controller = new SwapPanelController(new SwapPanelControllerParams[3] { 
                new SwapPanelControllerParams(ctrlInstalmentPlannerPanel, InstalmentPlannerHeadingBar),
                new SwapPanelControllerParams(accountReviewPanelRoot, AccountReviewHeadingBar),
                new SwapPanelControllerParams(setCallBackRoot, SetCallBackHeadingBar) });
		}


		/////////////////////////////////////////////////////////////
		// Operations

 		public void PostSupportDataLoad()
		{

			// Call child control functions
			ctrlInstalmentPlannerPanel.PostSupportDataLoad();
			//ctrlActiveInstalmentPlanPanel.PostSupportDataLoad();
			ctrlDaysWorked.PostSupportDataLoad();

		}

		public void Set(AccountTransport account)
		{

			// Set controls
			if (account.ActiveAccountPlan == null)
			{
				ctrlInstalmentPlannerPanel.Set(account);
				ctrlInstalmentPlannerPanel.Visibility = System.Windows.Visibility.Visible;
			}
			else
			{
				//ctrlActiveInstalmentPlanPanel.Set(account);
				//ctrlInstalmentPlannerPanel.Visibility = System.Windows.Visibility.Collapsed;
				//ctrlActiveInstalmentPlanPanel.Visibility = System.Windows.Visibility.Visible;
			}
			ctrlDaysWorked.Set(account);

		}

	}

}
